package com.example.beauty.service.impl;

import com.example.beauty.entity.Image;
import com.example.beauty.mapper.ImageMapper;
import com.example.beauty.resp.RespCode;
import com.example.beauty.resp.RespModel;
import com.example.beauty.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author qin
 * @create 2022--09--06--16:38
 * spring自动装配：  1、byType  2、byName
 */
@Service
public class ImageServiceImpl implements ImageService {
//    把mapper注入到service
    @Resource
    private ImageMapper imageMapper;
    @Override
    public RespModel getImageByType(String type) {
        try {
            List<Image> images = imageMapper.getImageByType(type);
            return new RespModel(RespCode.SUCCESS,images);

        }catch (Exception e){
            e.printStackTrace();
            return new RespModel(RespCode.FAIL,null);
        }
    }
}
